package com.clkj.zhonghui.service.system;

import com.clkj.zhonghui.dao.system.UrlMapper;
import com.clkj.zhonghui.pojo.system.Url;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @Author：周佳润
 * @Date：2024/7/10 上午10:34
 */

@Service
public class UrlServiceImpl implements UrlService {

    @Autowired
    private UrlMapper urlMapper;

    @Override
    public Void addUrl(Url url) {
        urlMapper.insertSelective(url);
        return null;
    }

    @Override
    public List<Url> listUrl(Integer urlId) {
        Example example = new Example(Url.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("urlId",urlId);
        return urlMapper.selectByExample(example);
    }

    @Override
    public void updateUrl(Url url) {

        urlMapper.updateByPrimaryKeySelective(url);
    }

    @Override
    public void delUrl(Integer urlId) {
        urlMapper.deleteByPrimaryKey(urlId);

    }
}
